<template>
	
		
		<!-- 基础卡片 -->
		<view class="listcard" @click="toDetail(leaf)">
			<view class="listcard-img">
				<!-- 完全填充 -->
				<image :src="leaf.leaf_img" mode="aspectFill"></image>
			</view>
			<view class="listcard-content">
				<view class="listcard-content-title">
					<text>{{leaf.leaf_name}}</text>
				</view>
				<view class="listcard-content-des">
					<view class="listcard-content-__des-label">
						<view class="listcard-content-__des-label-item">￥{{leaf.price}}</view>
					</view>
					<view class="listcard-content-__des-browe">{{leaf.views}}浏览</view>
				</view>
			</view>
		</view>
		
	
</template>

<script>
	export default {
		data() {
			return {
				src:require('../../../../manager/assets/tea08.png')
			};
		},
		onLoad(){
		},
		methods:{
			toDetail(item){
				//跳转到详情
				console.log("跳转到详情页")
				uni.navigateTo({
					url:"../detail/detail?pageSource=list-card&data="+encodeURIComponent(JSON.stringify(item)),
				})
			}
		},
		watch:{
			leaf:{
				handler(newValue,oldValoue){
					console.log(newValue)
					this.leaf=newValue
				},
				deep:true,
				immediate:false
			}
		},
		props:{
			leaf:{
				type:Object,
				default(){
					return {}
				}
			}
		}
	}
</script>

<style lang="scss">
	.listcard{
		display: flex;
		padding: 10px 10px;
		margin: 10px 10px;
		border-radius: 5px;
		box-shadow: 0 0 5px 1px rgba($color: #000000, $alpha: 0.1);
		box-sizing: border-box;
		
		.listcard-img{
			flex-shrink: 0;
			width: 60px;
			height: 60px;
			border-radius: 5px;
			overflow: hidden;
			image{
				width: 100%;
				height: 100%;
			}
		}
		
		.listcard-content{
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			padding-left: 10px;
			width: 100%;
			
			.listcard-content-title{
				font-size: 14px;
				color: #333;
				font-weight: 400;
				line-height: 1.0;
				text{
					//文本超出部分...显示
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box ;
					-webkit-line-clamp:1;
					-webkit-box-orient:vertical;
				}
			}
			
			.listcard-content-des{
				display: flex;
				//两端对齐
				justify-content: space-between;
				font-size: 12px;
				
				.listcard-content-__des-label{
					display: flex;
					.listcard-content-__des-label-item{
						padding: 0 5px;
						margin-right: 5px;
						border-radius: 15px;
						border: 1px red solid;
					}
				}
				.listcard-content-__des-browe{
					color: #999;
					line-height: 1.5;
				}
			}
		}
	}
</style>
